Skip to content

Report structurally invalid workflows to users#37116

Merged
silverwind merged 12 commits intogo-gitea:mainfrom
bircni:fix/invalid_workflow
Apr 9, 2026
Merged

Report structurally invalid workflows to users#37116
silverwind merged 12 commits intogo-gitea:mainfrom
bircni:fix/invalid_workflow

Conversation

@bircni
Copy link
Copy Markdown
Member

@bircni bircni commented Apr 5, 2026

model.ReadWorkflow succeeds for YAML that is syntactically valid but fails deeper parsing in jobparser.Parse (e.g. blank lines inside run: | blocks cause a SetJob round-trip error). Add ValidateWorkflowContent which runs the full jobparser.Parse to catch these cases, and use it in the file view, the actions workflow list, and the workflow detection loop so users see the error instead of silently getting a 500 or a dropped workflow.

Fixes #37115

`model.ReadWorkflow` succeeds for YAML that is syntactically valid but
fails deeper parsing in `jobparser.Parse` (e.g. blank lines inside
`run: |` blocks cause a SetJob round-trip error). Add
`ValidateWorkflowContent` which runs the full `jobparser.Parse` to catch
these cases, and use it in the file view, the actions workflow list, and
the workflow detection loop so users see the error instead of silently
getting a 500 or a dropped workflow.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 5, 2026
@bircni bircni marked this pull request as draft April 5, 2026 20:18
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Apr 5, 2026
@bircni bircni marked this pull request as ready for review April 6, 2026 10:23
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 6, 2026
@Zettat123 Zettat123 self-requested a review April 8, 2026 17:21
Co-authored-by: Zettat123 <[email protected]>
Signed-off-by: Nicolas <[email protected]>
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 8, 2026
@bircni bircni added backport/v1.26 This PR should be backported to Gitea 1.26 reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. labels Apr 8, 2026
@wxiaoguang wxiaoguang marked this pull request as draft April 9, 2026 01:27
@wxiaoguang wxiaoguang force-pushed the fix/invalid_workflow branch from 12a8802 to 128a211 Compare April 9, 2026 01:33
@wxiaoguang wxiaoguang marked this pull request as ready for review April 9, 2026 01:34
@wxiaoguang wxiaoguang changed the title Report structurally invalid workflows to users (#37115) Report structurally invalid workflows to users Apr 9, 2026
@wxiaoguang
Copy link
Copy Markdown
Contributor

wxiaoguang commented Apr 9, 2026

By the way, removed the (#issue) from title, otherwise the backport message would be too complex: title (#issue) (#origin-pr) (#backport-pr)

@silverwind silverwind merged commit 980a899 into go-gitea:main Apr 9, 2026
26 checks passed
@GiteaBot GiteaBot added this to the 1.27.0 milestone Apr 9, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 9, 2026
@bircni bircni deleted the fix/invalid_workflow branch April 9, 2026 13:18
GiteaBot added a commit to GiteaBot/gitea that referenced this pull request Apr 9, 2026
`model.ReadWorkflow` succeeds for YAML that is syntactically valid but
fails deeper parsing in `jobparser.Parse` (e.g. blank lines inside `run:
|` blocks cause a SetJob round-trip error). Add
`ValidateWorkflowContent` which runs the full `jobparser.Parse` to catch
these cases, and use it in the file view, the actions workflow list, and
the workflow detection loop so users see the error instead of silently
getting a 500 or a dropped workflow.

Fixes go-gitea#37115
Signed-off-by: Nicolas <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: Zettat123 <[email protected]>
Co-authored-by: Giteabot <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Apr 9, 2026
silverwind pushed a commit that referenced this pull request Apr 9, 2026
Backport #37116 by @bircni

`model.ReadWorkflow` succeeds for YAML that is syntactically valid but
fails deeper parsing in `jobparser.Parse` (e.g. blank lines inside `run:
|` blocks cause a SetJob round-trip error). Add
`ValidateWorkflowContent` which runs the full `jobparser.Parse` to catch
these cases, and use it in the file view, the actions workflow list, and
the workflow detection loop so users see the error instead of silently
getting a 500 or a dropped workflow.

Fixes #37115

Signed-off-by: Nicolas <[email protected]>
Co-authored-by: Nicolas <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: Zettat123 <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 10, 2026
* main:
  Make Markdown fenced code block work with more syntaxes (go-gitea#37154)
  Remove unneeded doctor sub-commands (go-gitea#37156)
  Report structurally invalid workflows to users (go-gitea#37116)
  Replace `rollup-plugin-license` with `rolldown-license-plugin` (go-gitea#37130)
  Clean up and improve non-gitea js error filter (go-gitea#37148)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/done All backports for this PR have been created backport/v1.26 This PR should be backported to Gitea 1.26 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some invalid workflow are not reported as invalid

6 participants